package de.slothsoft.commons.swing;

import javax.swing.JComponent;
import javax.swing.table.TableCellRenderer;

/**
 * A composite (like a JFrame, a JDialog or a JPanel) creating a table.
 * 
 * @author Steffi
 */
public interface ITableCreator<T> {

    /**
     * Creates the component on top of the table. Most of the time, this is a
     * toolbar and / or some filter controls.
     * 
     * @return a JComponent or null, if no filter component is wanted
     */

    JComponent createFilterComponent();

    /**
     * Creates the component on the bottom of the table. Most of the time, this
     * is a status bar or some other kind of information showing component.
     * 
     * @return a JComponent or null, if no filter component is wanted
     */

    JComponent createInformationComponent();

    /**
     * Performs an event, when the table selection changes
     */

    void performSelectionChanged();

    /**
     * Performs an event, when the table is double clicked
     */

    void performDoubleClick();

    /**
     * Creates a table model
     * 
     * @return a model
     */

    AbstractListTableModel<T> createModel();

    /**
     * Creates a table renderer
     * 
     * @return a renderer
     */

    TableCellRenderer createRenderer();

    /**
     * Creates the columns' widths. Might return null.
     * 
     * @return the widths
     */

    int[] createColumnWidths();

}
